<?php
// 导入定义路由映射关系的自定义函数库
require_once CORE_DIR . "/http/handler.php";

// 定义路由映射关系
// 用户操作
post("/login", function () {
    echo json_encode(app\controllers\login::execute(), JSON_UNESCAPED_UNICODE);
});

post("/register", function () {
    echo json_encode(app\controllers\register::execute(), JSON_UNESCAPED_UNICODE);
});

request("/logout", function () {
    echo json_encode(app\controllers\logout::execute(), JSON_UNESCAPED_UNICODE);
});

get("/get_student_info", function () {
    echo json_encode(app\controllers\get_student_info::execute(), JSON_UNESCAPED_UNICODE);
});

get("/get_student_grade", function () {
    echo json_encode(app\controllers\get_student_grade::execute(), JSON_UNESCAPED_UNICODE);
});

post("/add_student", function () {
    echo json_encode(app\controllers\add_student::execute(), JSON_UNESCAPED_UNICODE);
});

post("/delete_student", function () {
    echo json_encode(app\controllers\delete_student::execute(), JSON_UNESCAPED_UNICODE);
});

post("/update_student_grade", function () {
    echo json_encode(app\controllers\update_student_grade::execute(), JSON_UNESCAPED_UNICODE);
});

post("/update_student_info", function () {
    echo json_encode(app\controllers\update_student_info::execute(), JSON_UNESCAPED_UNICODE);
});

get("/get_verify", function () {
    echo json_encode(app\controllers\get_verify::execute(), JSON_UNESCAPED_UNICODE);
});

post("/operate_verify", function () {
    echo json_encode(app\controllers\operate_verify::execute(), JSON_UNESCAPED_UNICODE);
});

post("/change_password", function () {
    echo json_encode(app\controllers\change_password::execute(), JSON_UNESCAPED_UNICODE);
});

// 处理路由
require_once "handler.php";